<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>htmlcss 阶段</title>
    <style></style>
</head>
<body>



<script>
    // 要求：
        // 定义函数 foo ，把格式为 aaa-bbb-ccc的字符串处理成数组并返回
        // 例如：
        // foo("aaa-bbb-ccc");// ["aaa","bbb","ccc"]

        
        function foo(str){
            var index = str.slice(3,4);
            // console.log(index)
            var res = str.replace(index  , " ");
            // console.log(res);
            var index2 = res.slice(7,8);
            var he = res.replace(index2 , " "); 
            // console.log(he);
            var too = he.split(" ");
            return too;
        }
        var she = foo("aaa-bbb-ccc");
        console.log(she);
</script>
</body>
</html>